package com.wdh.kjs.fragment;

import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;

import com.wdh.kjs.R;
import com.wdh.kjs.activity.AccountDetailsActivity;
import com.wdh.kjs.activity.AccountOverviewActivity;
import com.wdh.kjs.activity.InvestManageActivity;
import com.wdh.kjs.activity.SecuritySetting;

/**
 * Created by codingWw on 2016/3/7.
 */
public class MyAccountFragment extends Fragment implements View.OnClickListener{

    private ImageView accountDetail;
    private ImageView accountOverview;
    private ImageView investmentManagement;
    private ImageView security;
    private Intent intent;
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_myaccount, container, false);
        initview(view);
        initwidge();
        return view;
    }

    private void initwidge() {
        security.setOnClickListener(this);
        accountDetail.setOnClickListener(this);
        accountOverview.setOnClickListener(this);
        investmentManagement.setOnClickListener(this);
    }

    private void initview(View view) {
        accountDetail = (ImageView)view.findViewById(R.id.accountDetail);
        accountOverview = (ImageView)view.findViewById(R.id.accountOverview);
        investmentManagement = (ImageView)view.findViewById(R.id.investmentManagement);
        security = (ImageView)view.findViewById(R.id.security);
    }

    @Override
    public void onClick(View view) {
        switch (view.getId()){
            case R.id.accountDetail:
                intent = new Intent(getActivity(), AccountDetailsActivity.class);
                startActivity(intent);
                break;
            case R.id.accountOverview:
                intent = new Intent(getActivity(), AccountOverviewActivity.class);
                startActivity(intent);
                break;
            case R.id.investmentManagement:
                intent = new Intent(getActivity(), InvestManageActivity.class);
                startActivity(intent);
                break;
            case R.id.security:
                intent = new Intent(getActivity(), SecuritySetting.class);
                startActivity(intent);

        }
    }
}
